<?php
namespace Admin\Controller;
class OwnerController extends IsloginController{
	function oper(){
		$user = M("Owner");
		$num=$user->count();
// 		3、规定每页显示的条数
		$pageSize=8;
// 		4、实例化分页类
		$pageOb=new \Think\Page($num,$pageSize);
// 		5、获取开始位置值
		$start=$pageOb->firstRow;
// 		6、获取分页结果
		$pageStr=$pageOb->show();
		$arr = $user->limit("$start,$pageSize")->select();
		if($arr){
			$this->assign('pageStr',$pageStr);
			$this->assign('arr',$arr);
		}else{
			
		}
		$this->show();
	}
	function  update(){
		$up = M("Owner");
		$id=$_GET['id'];
		$arr = $up->where("id=$id")->find();
		$this->assign('arr',$arr);
		$this->show();
	}
	function save(){
		$tianjia = M("Owner");
		$_POST['addtime']=time();
		$re = $tianjia->data($_POST)->save();
		if($re){
			echo "chengong!";
		}else{
			echo "no";
		}
	}
	function del(){
		$del = M("Owner");
		$id=$_POST["id"];
		$re = $del->where("id=$id")->delete();
		if($re){
			$this->success("删除成功",U("Owner/oper"));
		}else{
			$this->error("删除失败",U("Owner/oper"));
		}
	}


}